﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Hr.Entity;
using Chenxin.Lib.Utility;
using Chenxin.Lib.Business;
using System.Text;
namespace Chenxin.Lib.Business.BLL
{
    /// <summary>
    /// 业务逻辑类NotLitigationInfo 的摘要说明。
    /// </summary>
    public class NotLitigationInfo
    {
        public NotLitigationInfo()
        { }
        #region  成员方法
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo model)
        {
             Chenxin.Lib.Business.DAL.t_Business_NotLitigationInfo.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo model)
        {
            Chenxin.Lib.Business.DAL.t_Business_NotLitigationInfo.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(Guid RecordId)
        {

            Chenxin.Lib.Business.DAL.t_Business_NotLitigationInfo.Delete(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo GetModel(Guid RecordId)
        {

            return Chenxin.Lib.Business.DAL.t_Business_NotLitigationInfo.GetModel(RecordId);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.t_Business_NotLitigationInfo.GetList(strWhere);
        }
        
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.Business.DAL.t_Business_NotLitigationInfo.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo> modelList = new List<Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.Business.Entity.t_Business_NotLitigationInfo();
                    if (dt.Rows[n]["RecordId"].ToString() != "")
                    {
                        model.RecordId = new Guid(dt.Rows[n]["RecordId"].ToString());
                    }
                    if (dt.Rows[n]["ContractId"].ToString() != "")
                    {
                        model.ContractId = new Guid(dt.Rows[n]["ContractId"].ToString());
                    }
                    model.ContractCode = dt.Rows[n]["ContractCode"].ToString();
                    if (dt.Rows[n]["HasAttachment"].ToString() != "")
                    {
                        model.HasAttachment = int.Parse(dt.Rows[n]["HasAttachment"].ToString());
                    }
                    model.HouseAddress = dt.Rows[n]["HouseAddress"].ToString();
                    if (dt.Rows[n]["AppCityId"].ToString() != "")
                    {
                        model.AppCityId = new Guid(dt.Rows[n]["AppCityId"].ToString());
                    }
                    model.AppCity = dt.Rows[n]["AppCity"].ToString();
                    if (dt.Rows[n]["AppCompanyId"].ToString() != "")
                    {
                        model.AppCompanyId = new Guid(dt.Rows[n]["AppCompanyId"].ToString());
                    }
                    model.AppCompany = dt.Rows[n]["AppCompany"].ToString();
                    if (dt.Rows[n]["AppDepartId"].ToString() != "")
                    {
                        model.AppDepartId = new Guid(dt.Rows[n]["AppDepartId"].ToString());
                    }
                    model.AppDepart = dt.Rows[n]["AppDepart"].ToString();
                    if (dt.Rows[n]["AcceptedDate"].ToString() != "")
                    {
                        model.AcceptedDate = DateTime.Parse(dt.Rows[n]["AcceptedDate"].ToString());
                    }
                    if (dt.Rows[n]["MailDate"].ToString() != "")
                    {
                        model.MailDate = DateTime.Parse(dt.Rows[n]["MailDate"].ToString());
                    }
                    model.Description = dt.Rows[n]["Description"].ToString();
                    model.Memo = dt.Rows[n]["Memo"].ToString();
                    if (dt.Rows[n]["AddTime"].ToString() != "")
                    {
                        model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
                    }
                    if (dt.Rows[n]["AddPersonId"].ToString() != "")
                    {
                        model.AddPersonId = new Guid(dt.Rows[n]["AddPersonId"].ToString());
                    }
                    model.AddPerson = dt.Rows[n]["AddPerson"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        //*******************************************
        //功能概要       ：根据参数列表获得用户信息一览
        //参数説明       ：hsParams 参数列表
        //返回值説明     ：无
        //功能詳細       ：根据参数列表获得用户信息一览
        //作成者         ：zou.xiaochun
        //作成日         ：2010-09-28
        //*******************************************
        public DataSet GetModelListByCoditions(string strWhere, int strPageIndex, int strPageSize)
        {
            //排序
            string strOrderField = " AcceptedDate desc";
            //欲选择字段列表 
            string FieldList = " RecordId,HasAttachment,ContractCode,HouseAddress,AppDepart,AcceptedDate,Memo ";
            //子查询欲选择字段列表
            StringBuilder sb = new StringBuilder();
            sb.Append(" RecordId,HasAttachment,ContractCode,HouseAddress,AppDepart,AcceptedDate,Memo ");
            //所要查询的表名
            string TableName = " t_Business_NotLitigationInfo ";
            return Chenxin.Lib.Business.DAL.t_Business_NotLitigationInfo.GetList(strPageIndex, strPageSize, strOrderField, TableName, strWhere, FieldList, sb.ToString(), true);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        #endregion  成员方法
    }
}

